import { postSearchListAPI } from "@/api";

const state = {
	searchList: {},
};

const mutations = {
	POSTSearchList(state, data) {
		state.searchList = data;
	},
};

const actions = {
	async postSearchList({ commit }, params = {}) {
		const res = await postSearchListAPI(params);
		if (res.code === 200) {
			commit("POSTSearchList", res.data);
		}
	},
};

const getters = {
	goodsList(state) {
		return state.searchList.goodsList || [];
	},
	trademarkList(state) {
		return state.searchList.trademarkList || [];
	},
	attrsList(state) {
		return state.searchList.attrsList || [];
	},
	total(state){
	return state.searchList.total || 0
	}
};

export default {
	namespaced: true,
	state,
	mutations,
	actions,
	getters,
};
